<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['shopTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__ROOT__/Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
      <link rel="stylesheet" href="__ROOT__/Apps/Admin/View/css/daterangepicker/daterangepicker-bs3.css">
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__ROOT__/Apps/Admin/View/js/daterangepicker.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script type="text/javascript" src="__PUBLIC__/plugins/echarts/echarts.common.min.js"></script>
   </head>
   <script>
   
   function statSales(){
	   var style,option;
	   var params = {};
	   var date = $('#queryDate').val().split(' -> ');
	   params.payType = $('#payType').val();
	   params.startDate = date[0];
	   params.endDate = date[1];
	   var myChart = echarts.init(document.getElementById('container')); 
	   
	   $('#container').show();
	   $.post("{:U('Admin/Reports/getStatSales')}",params,function(data,textStatus){
			var json = WST.toJson(data);
			var option = {
					tooltip : { trigger: 'axis' },
					toolbox: {
						show : true,
						feature : {
							mark : {show: true},
							dataView : {show: false, readOnly: false},
							magicType : {show: true, type: ['line', 'bar']},
							restore : {show: true},
							saveAsImage : {show: true}
						}
					},
					calculable : true,
					xAxis : [{
						type : 'category',
						data : json.days
					}],
					yAxis : [{
						type : 'value'
					}],
					series : [{
						name:'销售额',
						type:'bar',
						data:json.dayVals
					}]
				};            
			myChart.setOption(option);	 
		});
	    
   }
   $(function(){
	   $('#queryDate').daterangepicker({format:'YYYY-MM-DD',separator:' -> '});
	   statSales();
   });
   </script>
   <body class='wst-page'>
      <form method="post">
       <div class='wst-tbar'>
 		统计时间：<input type='text' id='queryDate' class="form-control" readonly='true' style='width:200px' value='{$startDate} -> {$endDate}'/>
    	支付方式：<select id="payType" class="ipt">
				<option value="-1">全部</option>
				<option value="0">货到付款</option>
				<option value="1">在线支付</option>
			</select>
          <input type="button" class="btn btn-primary glyphicon glyphicon-search" onclick='javascript:statSales()' value='查询'/>
       </div>
       </form>
       <div class="wst-body"> 
	       <div id="container" style="min-width:700px;height:800px"></div>
       </div>
   </body>
</html>